package com.ror.jvm.direct.memory;

import java.io.IOException;
import java.nio.ByteBuffer;

public class Demo01ByteBuffer {
    private static final int _1Gb = 1024 * 1024 * 1024;

    public static void main(String[] args) throws IOException {
        System.out.println("开始分配……");
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(_1Gb);
        System.out.println("分配完毕，按回车键释放。");
        System.in.read();
        System.out.println("开始释放……");
        byteBuffer = null;
        System.gc();
        System.out.println("释放完毕。");
    }
}
